Last-day panic got me through this. Took me about two hours to build in total.


In order:

00000 -> Fe-Pb
00001 -> Pb-Pb
00010 -> Fe-Sn
00011 -> Sn-Pb
00100 -> Sn-Fe
00101 -> Pb-Sn
00110 -> Fe-Fe
00111 -> Sn-Sn
01000 -> Au-Pb
01001 -> Cu-Pb
01010 -> Au-Sn
01011 -> Ag-Pb
01100 -> Ag-Fe
01101 -> Cu-Sn
01110 -> Au-Fe
01111 -> Ag-Sn
10000 -> Fe-Cu
10001 -> Pb-Cu
10010 -> Fe-Ag
10011 -> Sn-Cu
10100 -> Sn-Au
10101 -> Pb-Ag
10110 -> Fe-Au
10111 -> Sn-Ag
11000 -> Au-Cu
11001 -> Cu-Cu
11010 -> Au-Ag
11011 -> Ag-Cu
11100 -> Ag-Au
11101 -> Cu-Ag
11110 -> Au-Au
11111 -> Ag-Ag

I came up with the base algorithm two weeks ago, and haven't changed it since except for some permutations (and one change I will explain below).

Here is the implemented algorithm, big-endian numbering:

Bit 0 if on boosts atom 1 by 3.
Bit 1 if on boosts atom 0 by 3.
Bit 2 if on boosts atom 1 by 1.
Bit 3 if on boosts atom 0 by 1.
Bit 4 if off (!) boosts both atoms by 1, except that if bits 2-4 are all off it boosts atom 0 by 1 twice.

The original idea I had was that bit 4 would boost both atoms if ON, except that it would boost one atom twice if the last three bits were 001. I changed it because a test for 000 is easier.
It also boosted by 1 instead of 3 and by 2 instead of 1; the change was to minimize the number of distinct boosts that were by multiple atoms.